-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow preexisting wrapper and custom class names #16805
base: gh-pages
Are you sure you want to change the base?
Allow preexisting wrapper and custom class names #16805
Conversation
Fix test so that it expect the input's wrapper to have a class of "awesomplete-wrapper"
className: "awesomplete", | ||
around: input | ||
}); | ||
this.container = $("." + this.containerClass, this.input.parentNode) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the point is allowing a custom element for this, why not accept an element instead of a class? Or a selector, at the very least? Also, how will an element be around input and still be a child of its parent? Unless I’m missing something, that seems impossible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehm, no not really...
#16718 is about having a structure where an element must remain a sibling of the input, like in many material-design implementations.
right now, if we have
<div class="some-wrapper-class">
<input id="search" class="awesomplete someOtherClass" />
<label for="search">Search for something</label>
</div>
Awesomplete will wrap the input with a div, separating it from from the label:
<div class="some-wrapper-class">
<div class="awesomplete">
<input id="search" class="awesomplete someOtherClass" />
</div>
<label for="search">Search for something</label>
</div>
What's needed to resolve #16718 is for new Awesomeplete('.awsomplete', {containerClass: 'some-wrapper-class'}
to not wrap the input - because it is already wrapped by some-wrapper-class
- leaving us with the original structure, so that the input and the label remain siblings.
This, inherently, also allows for custom elements, as it just looks at the existing html to see if it can be left as is, or needs modifying, based on a class name. new Awesomplete
should just leave the following as is, allowing for the wrapper to be an element that isn't a div
:
<label class="awesomplete">
<input id="search" class="awesomplete someOtherClass" />
Search for something
</label>
Hello there! Thanks for contributing! |
Revert css changes; Update docs
Done |
This conflicts, at least in general purpose, with #16787, which sparked a discussion on the relation of Awesomplete to Bliss. The web of interconnected issues here likely means this PR (and that one) need to wait a bit before some of the underlying issues are made concrete. |
Any news? |
This PR adds two, somewhat related features:
is-visually-hidden
, there is no reason to duplicate that style forvisually-hidden
. Similarly, it is a likely use case that people using OOCSS style classes will want to assign classes to theul
.awesomplete-wrapper
by default).awesomplete-wrapper
or the user-defined class.CSS, documentation and test updated to represent chnages.